package com.example.interfaces.exchange_confirm_01;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * ClassName: Consumer
 * author: bob.ly
 * Version: 1.0.0
 * DateTime: 2021/07/26-22:27:00
 * Description:
 */
@Component
@Slf4j
public class Consumer {
    private static final String CONFIRM_EXCHANGE_NAME = "confirm.exchange";

    @RabbitListener(queues = "confirm.queue")
    public void receiveMsg(Message message) throws UnsupportedEncodingException {
        String msg = new String(message.getBody(), "UTF-8");
        log.info("接受到的队列消息为:{}", msg);
    }
}
